package com.mhc.haval.manager.impl;

import com.mhc.haval.dal.mapper.ext.StaffRoleExtMapper;
import com.mhc.haval.dal.model.StaffRoleDO;
import com.mhc.haval.dal.query.StaffRoleQuery;
import com.mhc.haval.manager.StaffRoleManager;
import com.subaru.common.query.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * Manager for StaffRole.
 */

@Service
public class StaffRoleManagerImpl implements StaffRoleManager{

    
    @Autowired
    protected StaffRoleExtMapper staffRoleExtMapper;
    /**
     * query count by query condition.
     */
    @Override
    public int countByQuery(StaffRoleQuery query){
        return staffRoleExtMapper.countByQuery(query);
    }

    /**
     * delete by query condition.
     */
    @Override
    public int deleteByQuery(StaffRoleQuery query){
        return staffRoleExtMapper.deleteByQuery(query);
    }

    /**
     * delete by primary key.
     */
    @Override
    public int deleteByPrimaryKey(StaffRoleDO record){
        return staffRoleExtMapper.deleteByPrimaryKey(record);
    }

    /**
     * insert selective.
     */
    @Override
    public long insertSelective(StaffRoleDO record){
        return staffRoleExtMapper.insertSelective(record);
    }

    /**
     * select by query condition.
     */
    @Override
    public List<StaffRoleDO> selectByQuery(StaffRoleQuery query){
        return staffRoleExtMapper.selectByQuery(query);
    }

    /**
     * select by query condition with page.
    */
    @Override
    public PageResult<StaffRoleDO> selectByQueryWithPage(StaffRoleQuery query) {
        PageResult<StaffRoleDO> result = new PageResult<StaffRoleDO>();
        result.setPageSize(query.getPageSize());
        result.setPageNo(query.getPageNo());
        result.setTotalCount(this.countByQuery(query));
        result.setResult(this.selectByQuery(query));
        return result;
    }

    /**
     * select by primary key.
     */
    @Override
    public StaffRoleDO selectByPrimaryKey(Long id){
        return staffRoleExtMapper.selectByPrimaryKey(id);
    }

    /**
     * select by staff id.
     */
    @Override
    public List<StaffRoleDO> selectByStaffId(Long staffId){
        return staffRoleExtMapper.selectByStaffId(staffId);
    }

    /**
     * update by query condition selective.
     */
    @Override
    public int updateByQuerySelective( StaffRoleDO record,  StaffRoleQuery query){
        return staffRoleExtMapper.updateByQuerySelective(record,  query);
    }

    /**
     * update by query condition.
     */
    @Override
    public int updateByQuery( StaffRoleDO record,  StaffRoleQuery query){

        return staffRoleExtMapper.updateByQuery(record, query);
    }

    /**
     * update by primary key selective.
     */
    @Override
    public int updateByPrimaryKeySelective(StaffRoleDO record){
        return staffRoleExtMapper.updateByPrimaryKeySelective(record);
    }
}